package net.paoding.rose.jade.statement.jexl.analysis.impl;

import net.paoding.rose.jade.statement.jexl.Jexl3Execute;
import net.paoding.rose.jade.statement.jexl.analysis.Analysis;

/**
 * @author fusheng.zhang
 * @date 2025/11/14
 */
public class NameSpaceAnalysis implements Analysis {
    private String namespace;
    private String methodName;
    private String methodParam;

    @Override
    public String toString() {
        return namespace + "@" + methodName + "(" + toStr(methodParam) + ")";
    }

    @Override
    public void execute(Jexl3Execute jexl3Execute) {
        Object o = jexl3Execute.execute(jexl3Execute.getParams(), jexl3Execute.getConstantParams(), toStr(this.toString()));
        jexl3Execute.setStr(o.toString());
    }

    public NameSpaceAnalysis(String namespace, String methodName, String methodParam) {
        this.namespace = namespace;
        this.methodName = methodName;
        this.methodParam = methodParam;
    }

    public String getNamespace() {
        return namespace;
    }

    public void setNamespace(String namespace) {
        this.namespace = namespace;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public String getMethodParam() {
        return methodParam;
    }

    public void setMethodParam(String methodParam) {
        this.methodParam = methodParam;
    }
}
